*******************************************************	
* Figure S2 - DYADIC
*******************************************************

ssc install vioplot

use dyads.dta, clear

sum lend borrow social religious kinship getgoods givegoods giveadvice getadvice medical govisit comevisit 

pwcorr lend borrow social religious kinship getgoods givegoods giveadvice getadvice medical govisit comevisit 

* number of other ties (besides lending and borrowing)
gen multiple_ties = social+religious+kinship+getgoods+givegoods+giveadvice+getadvice+medical+govisit+comevisit 

label variable multiple_ties "Number of non-financial ties between leader and contact"

* SUPPLEMENT FIGURE 1
vioplot multiple_ties, over(lend)
graph save SUPP-Figure-S2.gph, replace
graph export "SUPP-Figure-S2.pdf", as(.pdf) replace

ttest multiple_ties, by(lend)

/* T-TEST OF DIFFERENCES IN SOCIAL CONNECTIONS OF LEADERS
* 0 = no lend; 1= lend:
* leaders who lent money were more socially embedded in the villages and had higher-trust relationships, as measured by the number of other ties they had to their contacts; 

leaders who lent money had about 4 times more other (social and religious) ties to their contacts, on average, than leaders who did not lend money in their villages.

Therefore, the more connected leaders were also the ones who had informal financial relationships.

Two-sample t test with equal variances
------------------------------------------------------------------------------
   Group |     Obs        Mean    Std. err.   Std. dev.   [95% conf. interval]
---------+--------------------------------------------------------------------
       0 |   8,415     2.06631    .0161464    1.481163    2.034659    2.097961
       1 |   9,894    8.364969    .0299956    2.983615    8.306171    8.423766
---------+--------------------------------------------------------------------
Combined |  18,309    5.470042    .0292576    3.958869    5.412694     5.52739
---------+--------------------------------------------------------------------
    diff |           -6.298659    .0357716               -6.368774   -6.228543
------------------------------------------------------------------------------
    diff = mean(0) - mean(1)                                      t = -1.8e+02
H0: diff = 0                                     Degrees of freedom =    18307

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000
*/
